import 'package:flutter/material.dart';
import 'package:leader_help/value/topcolors.dart';
import 'package:get/get.dart';
import 'package:image_pickers/image_pickers.dart';
import 'state.dart';

class FeedbackLogic extends GetxController {
  final FeedbackState state = FeedbackState();


  ///选择多张图片 Select multiple images
  Future<void> selectImages() async {

    // state.listImagePaths = await ImagePickers.pickerPaths(
    //     galleryMode: GalleryMode.image,
    //     selectCount: 3,
    //     showGif: true,
    //     showCamera: true,
    //     compressSize: 500,
    //     uiConfig: UIConfig(uiThemeColor: TopColors.main_red),
    //     cropConfig: CropConfig(enableCrop: false, width: 2, height: 1));
    //
    // update();
  }


  //提交数据
  putData(){
    Get.dialog(
        AlertDialog(
          content: Column(children: [
            Container(child: Text('感谢您的反馈',
              style: TextStyle(color: TopColors.black_33, fontSize: 17),),
              margin: EdgeInsets.only(bottom: 15),),
            Text(
              '为了更好的确认问题，我们可能会与您取得联系，给您带来的不便敬请谅解。',
              style: TextStyle(color: TopColors.black_66, fontSize: 13),),
            GestureDetector(child: Container(width:200,child: Center(child: Text('确定',style: TextStyle(fontSize: 14,color: TopColors.tx_baoming,fontWeight: FontWeight.w600),),),decoration: BoxDecoration(gradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [
                Color(0xffF3DBB6),
                Color(0xffCBA76D),
              ],
            ),borderRadius: BorderRadius.all(Radius.circular(4))),padding: EdgeInsets.all(10),margin: EdgeInsets.fromLTRB(15,20,15,0),),onTap: (){
              Get.off(this);
              Get.off(this);
            },)
          ], mainAxisSize: MainAxisSize.min),
        )
    );
    // showDialog(context: context, builder: (context) {
    //   return AlertDialog(
    //     content: Column(children: [
    //       Container(child: Text('感谢您的反馈',
    //         style: TextStyle(color: TopColors.black_33, fontSize: 17),),
    //         margin: EdgeInsets.only(bottom: 15),),
    //       Text(
    //         '为了更好的确认问题，我们可能会与您取得联系，给您带来的不便敬请谅解。',
    //         style: TextStyle(color: TopColors.black_66, fontSize: 13),),
    //       GestureDetector(child: Container(width:200,child: Center(child: Text('确定',style: TextStyle(fontSize: 14,color: TopColors.tx_baoming,fontWeight: FontWeight.w600),),),decoration: BoxDecoration(gradient: LinearGradient(
    //         begin: Alignment.topCenter,
    //         end: Alignment.bottomCenter,
    //         colors: [
    //           Color(0xffF3DBB6),
    //           Color(0xffCBA76D),
    //         ],
    //       ),borderRadius: BorderRadius.all(Radius.circular(4))),padding: EdgeInsets.all(10),margin: EdgeInsets.fromLTRB(15,20,15,0),),onTap: (){
    //         Navigator.pop(context);
    //         Navigator.pop(this.context);
    //       },)
    //     ], mainAxisSize: MainAxisSize.min),
    //   );
    // }
  }

  //删除图片
  deletePic(int index){
    state.listImagePaths.removeAt(index);
    // multipartFiles.removeAt(index);

    update();
  }
}
